import http from "@/api";
import { ResPage } from "@/api/interface";
import {
ApiTripCreate,
ApiTripDelete,
ApiTripSearch,
ApiTripUpdate,
ApiTripExport,
ApiTripImport,
ApiTripImportTemplateFile,
} from "@/api/apis/trip";
import { ReqSearch } from "@/api/interface/Search/ReqSearch";
import { dtoTripCreate, dtoTripDelete, dtoTripInfo, dtoTripUpdate } from "@/api/dbdto/dtoTrip";

export const requestTripCreate = (params: dtoTripCreate) => {
return http.post(ApiTripCreate, params);
};

export const requestTripSearch = (params: ReqSearch) => {
return http.post<ResPage<dtoTripInfo>>(ApiTripSearch, params);
};

export const requestTripUpdate = (params: dtoTripUpdate) => {
return http.post(ApiTripUpdate, params);
};

export const requestTripDelete = (params: dtoTripDelete) => {
return http.post(ApiTripDelete, params);
};

//导入数据
export const requestTripImport = (params: FormData) => {
return http.post(ApiTripImport, params);
};

//获取导入数据文件模板
export const requestTripTemplateFile = (params = {}) => {
//,记得是download方法， md，使用post搞了半天
return http.download(ApiTripImportTemplateFile, {});
};

//导出数据
export const requestTripExport = (params: ReqSearch) => {
return http.download(ApiTripExport, params);
};
